package com.m4f.web.listener;

import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.logging.Logger;
import javax.servlet.ServletContextEvent;
import org.springframework.web.context.ContextLoaderListener;

public class RichContextLoaderListener extends ContextLoaderListener {
	
	private static final Logger LOGGER = Logger.getLogger(RichContextLoaderListener.class.getName());
	
	/* Application Startup Event */
	public void	contextInitialized(ServletContextEvent ce) {	
		long init = Calendar.getInstance().getTimeInMillis();
		Format formatter = new SimpleDateFormat("dd MMM yyyy HH:mm:ss");
		LOGGER.severe("Init: " + 
				formatter.format(init));
		super.contextInitialized(ce);
		long end =  Calendar.getInstance().getTimeInMillis();
		LOGGER.severe("++++ Start time: " + (end - init));
		LOGGER.severe("End: " + 
				formatter.format(end));
	}
	
	/* Application Shutdown	Event */
	public void	contextDestroyed(ServletContextEvent ce) {
		super.contextDestroyed(ce);
	}

	

}